<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item of banners" :key="item.id">
        <img :src="item.imgUrl" alt="" />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
export default {
  data() {
    return {
      banners: [],
    };
  },
  mounted() {
    this.$http(`http://122.112.161.135:4000/api/banner`).then((res) => {
      this.banners = res.data.res;
    });
  },
};
</script>

<style>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  text-align: center;
  z-index: 100;
}
.van-swipe-item img {
  width: 100%;
  height: 400px;
}
.van-swipe__indicators {
  right: 0;
  left: unset;
}
.van-swipe__indicator {
  width: 0.2rem;
  height: 0.2rem;
}
</style>